<?php
if(!defined('ADMINPX') || !defined('ADMIN')) {
	exit('Access Denied');
}
$act=$_GET['act'];
$uid=$_GET['uid'];
$id=$_GET['id'];
$aa=$_GET['aa'];
if($act =='xg'){
$row=$db->get_one('user'," `uid` ='$uid'",'');
$sjza=Bingz_time($row[time_a]);
$sjzb=Bingz_time($row[time_b]);
$hyatx=$user_class->user_tx($row[uid]);
if($row[sex] == '1'){$a='CHECKED';}else{$aa='CHECKED';}
if($row[user_qx] == '0'){$b0='CHECKED';}
echo <<<end
<div class="admin">修改UID($row[uid])资料<br/></div>
头像:<img src="$hyatx"  width="42" height="42" /></br>
<form method="POST" action="admin.php?action=user&act=txok&uid=$row[uid]" enctype="multipart/form-data">
图片：<input type="file" name="upfile"  class="text_x" />
<input class="submit" type="submit" value="上传头像" name="adminpost" />
</form></br>
<form method="POST" action="admin.php?action=user&act=ok&uid=$row[uid]">
UID : $row[uid]</br>
<b>户名</b>:<input class="text" type="text" name="nameva" value="$row[name]" /></br>
<b>性别</b>:
<input type="radio" $a name="sex" value="1" />女生
<input type="radio" $aa name="sex" value="2" />男生
</br>
<b>用户组</b>: 
end;
	 $sql=$db->query('user_qxz',"`type` = '1' ORDER BY `type_a` DESC ","");
	 while($rowqx=mysql_fetch_array($sql)){
	 	  $bb='';
	    if($row[user_qx] == $rowqx[id]){$bb='CHECKED';}
	    echo '<input type="radio" name="user_qx" value="'.$rowqx[id].'" '.$bb.'/>'.$rowqx[name].'';
	 }
echo <<<end
<input type="radio" $b0 name="user_qx" value="0" />普通会员
</br>
<b>积分</b>:<input class="text" type="text" name="jifen" value="$row[jifen]" /></br>
<b>$wzxx_jb_name</b>:<input class="text" type="text" name="money" value="$row[money]" /></br>
<b>$wzxx_yb_name</b>:<input class="text" type="text" name="yeobi" value="$row[yeobi]" /></br>
<b>签名</b>:<input class="text" type="text" name="user_qm" value="$row[user_qm]" /></br>
<b>密码</b>:<input class="text" type="text" name="va10" value="$row[password]" />(空不修改)</br>
<input class="submit" type="submit" name="adminpost" value="编辑资料"/>
</form>
<div class="admin_a">注意: 会员权限请认真设置，系统管理员可以登陆网站后台。<br/></div>
<div class="admin_a">注册  I P: $row[ip_at]<br/></div>
<div class="admin_a">活动IP地: $row[ip_dz]<br/></div>
<div class="admin_a">最后活动: $sjza<br/></div>
<div class="admin_a">注册时间: $sjzb<br/></div>
end;
echo "<a href=\"admin.php?action=user_renminbi&act=xg&uid=$uid\">人民币管理</a><br/>";
echo "<a href=\"admin.php?action=user&act=scaq&uid=$uid\">清空密保问题</a><br/>";
echo "<a href=\"admin.php?action=user&act=scmm&uid=$uid\">删除支付密码</a><br/>";
echo "<a href=\"admin.php?action=user_renzheng&act=sms&&uid=$uid\">全部认证管理</a><br/>";
echo "<a href=\"admin.php?action=user&act=scts&uid=$uid\">确定删除用户</a><br/>";
echo "<a href=\"admin.php?action=user&\">返回用户管理</a><br/>";
}else if($act =='txok'){
    	           $bzwjc=Bingz_upload('user/show/','1','1',$user_uid.'_');
    	           if($bzwjc[1] == '1'){
			  	    	     echo"上传成功<br/>";
  			             $db->update('user',array( 'show' => 'data/user/show/'.$bzwjc[2]),"`uid` = '$uid'");		    			  	
    	           }else{
                     echo'上传附件：'.$bzwjc[2].'';
                 }
                 echo "正在自动返回.......<br/><a href=\"admin.php?action=user&act=xg&uid=$uid\">请手动返回</a><br/><meta http-equiv=refresh content='3;url=admin.php?action=user&act=xg&uid=$uid'>";
}else if($act =='ok'){
     $row=$db->get_one('user'," `uid` ='$uid'",'');
     $pwss=$_POST[va10];
		 if(!$_POST[adminpost]){
	       echo"提交出错<br/>";
	   }else if(!admin_pdzh() && $db->get_one('user',"`uid` = '$uid' and `user_qx` = '1' ",'')){
	   	   echo"你好！都是系统管理员，不能编辑！<br/>";
	   }else{
	   	   if($db->update('user',array('name' => $_POST[nameva] ,'money' => $_POST[money] ,'yeobi' => $_POST[yeobi] ,'jifen' => $_POST[jifen] ,'sex' => $_POST[sex] , 'user_qm' => $_POST[user_qm])," `uid` ='$uid'")){
			        if($uid == '1000'){
			        	 echo "无法设置创始人用户组<br/>";
			        }else if(!admin_pdzh() && $_POST[user_qx] == '1'){
			        	 echo "不能设置系统管理员<br/>";
			        }else{	
			        	 $db->update('user',array('user_qx' => $_POST[user_qx])," `uid` ='$uid'");
			        }
			        if($_POST[va10]){
			        	 if($uid == '1000' && $Bingz_adminzh == '1'){
			        	 	  echo "系统关闭创始人密码修改<br/>";
			   	       }else{
			   	    	    $user_class->user_password($uid,$pwss,'你好！系统管理员修改了你的密码！');
			   	    	    echo "密码修改成功<br/>";
			   	    	 }
			        }
  		       echo "资料编辑成功<br/>";
	       }else{
			       echo "资料编辑失败<br/>";
		     }
		 }
		echo "<a href=\"admin.php?action=user&act=xg&uid=$uid\">返回管理会员</a><br/>";
    echo "<a href=\"admin.php?action=user&\">返回用户管理</a><br/>";
}else if($act=='scts'){
	 echo "注意：删除后，将要删除会员所有信息，不能恢复！<br/>";
   echo "<a href=\"admin.php?action=user&act=sc&uid=$uid\">确定删除</a><br/>";
}else if($act=='sc'){
	if(!admin_pdzh()){
	    echo "你好！你不是创始人，不能删除会员！<br/>";
	}elseif($uid == '1000'){
	    echo "你好！账号是创始人，不能删除操作！<br/>";
	}else{
      $db->delete('user'," `uid` = '$uid'");
      $db->delete('user_dl'," `uid` = '$uid'");
      $db->delete('user_haoy'," `uid` = '$uid'");
      $db->delete('forum'," `uid` = '$uid'");
      $db->delete('forum_hui'," `uid` = '$uid'");
      $db->delete('forum_data_user'," `uid` = '$uid'");
	    $sql=$db->query('forum_data'," `uid` ='$uid'ORDER BY `id` ","");
	    while($row=mysql_fetch_array($sql)){
	 	     @unlink (Bingz_upload_images('data/forum/'.$row[url].''));
	   	   @unlink('data/forum/'.$row[url].'');
   	     $db->delete('forum_data'," `id` = '$row[id]'");
      }
	 echo "删除成功<br/>";
	}
   echo "正在自动返回.......<br/><a href=\"admin.php?action=user\">请手动返回</a><br/><meta http-equiv=refresh content='3;url=admin.php?action=user'>";
}else if($act=='scaq'){
   $db->delete('user_pass'," `uid` = '$uid'");
	 echo "删除成功<br/>";
   echo "正在自动返回.......<br/><a href=\"admin.php?action=user&act=xg&uid=$uid\">请手动返回</a><br/><meta http-equiv=refresh content='3;url=admin.php?action=user&act=xg&uid=$uid'>";
}else if($act=='scmm'){
   $db->update('user',array( 'renminbi_pass' =>'' ),"`uid` = '$uid'");
	 echo "删除成功<br/>";
   echo "正在自动返回.......<br/><a href=\"admin.php?action=user&act=xg&uid=$uid\">请手动返回</a><br/><meta http-equiv=refresh content='3;url=admin.php?action=user&act=xg&uid=$uid'>";
}else{
echo  <<<end
<div class="admin_a">
<form method="POST" action="admin.php?action=user" >
<input type="text" name="mm" value="$name" size="30" placeholder="uid/手机号/邮箱" />
<input type="submit" value="查询" name="adminpost" />
</form>
</div>
end;
if($aa=='hd'){
       $num_count=$db->num_rows('user'," ",'uid');
       $list_num ="10";
       $num_start=page_num($list_num,$num_count);
       $sql_bbs  =$db->query('user'," ORDER BY `time_a` DESC LIMIT ".$num_start." , ".$list_num." ",'');
}elseif($aa=='old'){ 
       $num_count=$db->num_rows('user',"1 ",'uid');
       $list_num ="10";
       $num_start=page_num($list_num,$num_count);
       $sql_bbs  =$db->query('user',"1 ORDER BY `uid` LIMIT ".$num_start." , ".$list_num." ",'');
}elseif($aa=='qq'){ 
       $num_count=$db->num_rows('user',"`qq_openid` > '0' ",'uid');
       $list_num ="10";
       $num_start=page_num($list_num,$num_count);
       $sql_bbs  =$db->query('user',"`qq_openid` > '0' ORDER BY `uid` LIMIT ".$num_start." , ".$list_num." ",'');
}elseif($_POST[mm]){
	  if($waw=@$db->get_one('user'," `uid` ='$_POST[mm]' ",'')){
       $num_count=$db->num_rows('user'," `uid` = '$waw[uid]'",'uid');
       $list_num ="10";
       $num_start=page_num($list_num,$num_count);
       $sql_bbs  =$db->query('user'," `uid` = '$waw[uid]' ORDER BY `uid` DESC LIMIT ".$num_start." , ".$list_num." ",'');
	  }else if($waw=@$db->get_one('user'," `email` ='$_POST[mm]' ",'')){
       $num_count=$db->num_rows('user'," `uid` = '$waw[uid]'",'id');
       $list_num ="10";
       $num_start=page_num($list_num,$num_count);
       $sql_bbs  =$db->query('user'," `uid` = '$waw[uid]' ORDER BY `uid` DESC LIMIT ".$num_start." , ".$list_num." ",'');
	  }else if($waw=@$db->get_one('user'," `mobile` ='$_POST[mm]' ",'')){
       $num_count=$db->num_rows('user'," `uid` = '$waw[uid]'",'uid');
       $list_num ="10";
       $num_start=page_num($list_num,$num_count);
       $sql_bbs  =$db->query('user',"`uid` = '$waw[uid]' ORDER BY `uid` DESC LIMIT ".$num_start." , ".$list_num." ",'');
    }
}else{
       $num_count=$db->num_rows('user'," ",'uid');
       $list_num ="10";
       $num_start=page_num($list_num,$num_count);
       $sql_bbs  =$db->query('user'," ORDER BY `uid` DESC LIMIT ".$num_start." , ".$list_num." ",'');
}
$ts=$db->num_rows('user'," ",'uid');
$qqts=$db->num_rows('user',"`qq_openid` > '0' ",'uid');
echo  <<<end
<div class="admin_a">
<a href="admin.php?action=user"><b>倒序</b></a> -
<a href="admin.php?action=user&aa=old&$see"><b>顺排</b></a> -
<a href="admin.php?action=user&aa=hd&$see"><b>活动</b></a> -
<a href="admin.php?action=user&aa=qq&$see"><b>QQ</b></a> -
($qqts/$ts)</div>
end;
while($row=mysql_fetch_array($sql_bbs)){
	$sjz=Bingz_time($row[time_a]);
	echo"<div class=\"admin_a\">UID($row[uid])
	<a href=\"index.php?m=user&uid=$row[uid]\">$row[name]</a> -
	<a href=\"admin.php?action=user&act=xg&uid=$row[uid]\">管理会员</a><br/>";
echo  <<<end
活动时间:$sjz<br/>
活动地址:$row[ip_dz]
<br/></div>
end;
}
echo $page=page_link($list_num,$num_count);
}
?>